Weak Polymorphism Can Be
نویسنده
چکیده
The weak polymorphic type system of Standard ML of New Jersey (SML/NJ) (MacQueen, 1992) has only been presented as part of the implementation of the SML/NJ compiler, not as a formal type system. As a result, it is not well understood. And while numerous versions of the implementation have been shown unsound, the concept has not been proved sound or unsound. We present an explanation of weak polymorphism and show that a formalization of this is sound. We also relate this to the SML/NJ implementation of weak polymorphism through a series of type systems that incorporate elements of the SML/NJ type inference algorithm. 1 Background A reference cell is an assignable store location and is the primary imperative feature of Standard ML (SML) (Milner, et al., 1990). However, it is well known that its Hindley-Milner type system (Milner, 1978) is unsound if reference types are polymorphically generalized in the usual manner. For example, in the following expression, polymorphically generalizing the type of ref nil allows that reference cell to be used as both an int list ref and a bool list ref: let val a = ref nil in a := 1]; not (hd(!a)) end This code stores a list of integers in the cell, but then reads a list of booleans from it. Such inconsistencies must not be allowed by the type system. While it is unsound to polymorphically generalize reference types, it is not necessarily unsound to generalize function types involving reference types. A simple example is the following expression: let val ref' = fn x => ref x in ref' 1; ref' true end 2 John Greiner The function ref', which creates reference cells, can safely be used at both the types int-> int ref and bool-> bool ref. A number of type systems have been proposed to allow code such as the latter example while preserving soundness Of particular interest for this paper are those of Tofte (1988), which is used in the deenition of SML, and MacQueen (1992), which is used in the New Jersey implementation of SML (SML/NJ). In the standard Hindley-Milner type system, generalization is allowed on all free type variables not occurring in the variable type assumption, which is a mapping from variables to type schemes. As shown by Tofte, if references are added to the language, the type system must also have a location type assumption assigning a type to each …
منابع مشابه
Multilocus selection in subdivided populations II. Maintenance of polymorphism under weak or strong migration.
The potential of maintaining multilocus polymorphism by migration-selection balance is studied. A large population of diploid individuals is distributed over finitely many demes connected by migration. Generations are discrete and nonoverlapping, selection may vary across demes, and loci are multiallelic. It is shown that if migration and recombination are strong relative to selection, then wit...
متن کاملThree comments on the anti-frame rule
It is well-known that a careless combination of parametric polymorphism and weak references is unsound. (A weak reference is one that can be read and written without restrictions, as in ML.) The standard way to work around this problem is to rely on the value restriction [7] that is, to restrict the ∀-introduction rule to values (as opposed to arbitrary terms). Charguéraud and Pottier [3] point...
متن کاملP-212: Ala 307 Thr Polymorphism of FSHR in Iranian Patients with Polycystic Ovary Syndrome (PCOS)
Background: Follicle stimulating hormone (FSH) receptor plays an important role in FSH signaling during reproductive development. Any changes in FSHR gene is resulted in alteration of amino acid in protein chain, consequence to affect the binding affinity, intracellular signaling and expression levels of FSHR. FSHR polymorphisms can be involved in etiology of many reproductive disorders such as...
متن کاملWeak Disposability in Integer-Valued Data Envelopment Analysis
Conventional data envelopment analysis (DEA) models normally assume all inputs and outputs are real valued and continuous. However in problems some inputs and outputs can only take integer values, also, both desirable and undesirable outputs can be generated . In this paper the effect of undesirable outputs in integer DEA model is discussed. The proposed model distinguishes weak disposability o...
متن کاملPower of association tests in the presence of multiple causal variants
We show that the statistical power of a single single-nucleotide polymorphism (SNP) score test for genetic association reflects the cumulative effect of all causal SNPs that are correlated with the test SNP. Statistical significance of a score test can sometimes be explained by the collective effect of weak correlations between the test SNP and multiple causal SNPs. In a finite population, weak...
متن کاملEfficiency of BclI Restriction Fragment Length Polymorphism for Detection of Hemophilia A Carriers in Sistan and Baluchestan Province, Southeast of Iran
Background: Indirect genetic diagnosis using polymorphic DNA markers can detect carriers of hemophilia A. This technique is preferable in developing countries because of its simplicity and cost effectiveness compared to direct mutation analysis. In the present study, we examined usefulness of intragenic marker BclI restriction fragment length polymorphism (RFLP) at intron 18, for carrier detect...
متن کامل